<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fns" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>法律人</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/my-style.css">
	<!--[if lt IE 9]> 
		<script src="js/html5shiv.min.js"></script> 
	<![endif]-->
</head>
<body style="background:#f5f5f5;">
		<!-- 导航栏 -->
	<header>
		<nav class="navbar navbar-inverse">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
		        <span class="sr-only">Toggle navigation</span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
		      <a class="navbar-brand" href="index.html">
		        <img alt="LOGO" src="img/50x30.png">
		      </a>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse-1">
					<ul class="nav navbar-nav navbar-left">
					 	  <li><a href="index/home">首页</a></li>
				          <li><a href="lawyer/list">法律人</a></li>
				          <li><a href="contract/list">法律产品</a></li>
				         <li class="cur"><a href="knowledge/index">法律知识</a></li>
					</ul>

					<ul class="nav navbar-nav navbar-right">
						<li><a class="add-btn" href="index/join">法律人入驻<span class="caret"></span></a></li>
				<c:if test="${sessionScope.user == null}">
					<li><a href="user/login">登录</a></li>
					<li><a href="user/register">注册</a></li>
				</c:if>
				<c:if test="${sessionScope.user != null}">
					 <li>
								<c:if test="${sessionScope.user.type  == 0}">
								<a href="user/person">${sessionScope.user.username}</a>
								</c:if>
								<c:if test="${sessionScope.user.type  == 1}">
								<a href="lawyer/person">${sessionScope.user.username}</a>
								</c:if>
								<c:if test="${sessionScope.user.type  == 2}">
								<a href="lawyer/person">${sessionScope.user.username}</a>
								</c:if>
					    </li>
					<li><a href="user/logout">退出</a></li>
				</c:if>
			</ul>
				</div>
			</div>
		</nav>
	</header>
	
	<section>
		<div class="container">
			<div class="row" style="margin-bottom:20px;">
				<div class="col-md-12 col-sm-12 col-xs-12">
					<div class="list-select-border">
						<div class="list-select-box clearfix">
							<div class="pull-left list-label">
								<label>合同分类:</label>
							</div>
							<div class="pull-left list-select">
								<ul class="list-select-ul clearfix" id="list-select-ul1">
									<li <c:if test="${typeId == 0}">class="selected"</c:if> id="0"><a href="knowledge/list?type=0">全部</a></li>
									<li <c:if test="${typeId == 1}">class="selected"</c:if> id="1"><a href="knowledge/list?type=1">房地产知识</a></li>
									<li <c:if test="${typeId == 2}">class="selected"</c:if> id="2"><a href="knowledge/list?type=2">劳动人事知识</a></li>
									<li <c:if test="${typeId == 3}">class="selected"</c:if> id="3"><a href="knowledge/list?type=3">婚姻知识</a></li>
								</ul>
							</div>
						</div>
						<c:if test="${show==1}">
								<div class="list-select-box clearfix" id="list-select-box2">
									<div class="pull-left list-label">
										<label>合同细分:</label>
									</div>
									<div class="pull-left list-select">
										<ul class="list-select-ul clearfix" id="list-select-ul2">
												<li <c:if test="${s == 0}">class="selected"</c:if> data-id="${typeId}"  data-s="0"><a href="javascript:;">全部</a></li>
												<c:forEach items="${knowTypes}" var="type">
													<li <c:if test="${s == type.typeid}">class="selected"</c:if> data-id="${typeId}"  data-s="${type.typeid}"><a href="javascript:;">${type.name}</a></li>
												</c:forEach>
										</ul>
									</div>
								</div>
						</c:if>
						
						
					</div>
				</div>
			</div>
		</div>
	</section>

	<section>
		<div class="container">
			<div class="row">
				<div class="col-md-9 com-sm-9 col-xs-12">
					<div class="sidebar-box sidebar-detail-box">
						<c:forEach items="${details}" var="details">
						<a href="knowledge/detail/${details.knowledgeId}">
							<div class="msgs-box">
								<h3>${details.title}</h3>
								<span class="icon icon-clock">时间:<fmt:formatDate value="${details.publishTime}" pattern="yyyy-MM-dd"/></span>
								<span class="icon icon-link">来源:互联网</span>
								<span class="icon icon-head">作者:${details.author}</span>
								<p>${fns:substring(details.content, 0, 20)}......</p>
							</div>
						</a>
						</c:forEach>




							<!-- 分页 -->
						<!-- <nav>
						 	<div style="margin: 0 auto;width:235px;">
						 		 <ul class="pagination">
							    <li class="disabled">
							      <a href="#" aria-label="Previous">
							        <span aria-hidden="true">&laquo;</span>
							      </a>
							    </li>
							    <li class="active"><a href="#">1</a></li>
							    <li><a href="#">2</a></li>
							    <li><a href="#">3</a></li>
							    <li><a href="#">4</a></li>
							    <li><a href="#">5</a></li>
							    <li>
							      <a href="#" aria-label="Next">
							        <span aria-hidden="true">&raquo;</span>
							      </a>
							    </li>
							  </ul>
						 	</div>
						</nav> -->



					</div>
				</div>
				<div class="col-md-3 com-sm-3 hidden-xs">
					<div class="col-md-12 text-center hidden-xs clear-padding">
						<img src="img/lawadvertisement.png" alt="" width="260" height="200">
					</div>

					<div class="col-md-12 col-sm-12 col-xs-12 clear-padding center-block">
						<div class="sidebar-box">
							<h5>热门百科</h5>
							<hr/>
							<ul class="rank-list">
								<li><a href="knowledge/list?type=1"><i>1</i>房产转让</a></li>
								<li><a href="knowledge/list?type=2"><i>2</i>人事诉讼</a></li>
								<li><a href="knowledge/list?type=0"><i>3</i>事故赔偿</a></li>
								<li><a href="knowledge/list?type=0"><i>4</i>劳动争议</a></li>
								<li><a href="knowledge/list?type=0"><i>5</i>故意伤害</a></li>
								<li><a href="knowledge/list?type=0"><i>6</i>交通规则</a></li>
								<li><a href="knowledge/list?type=0"><i>7</i>保险理赔</a></li>
								<li><a href="knowledge/list?type=0"><i>8</i>医疗事故索赔</a></li>
								<li><a href="knowledge/list?type=0"><i>9</i>民间借贷</a></li>
								<li><a href="knowledge/list?type=0"><i>10</i>著作权纠纷</a></li>
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>







	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function(){

			//一级菜单选择事件
	
			$('#list-select-ul1 li').click(function() {
				var knowledgeId = $(this).attr("id");
				location.href = "knowledge/list?type=" + knowledgeId;
			});
			
			$('#list-select-ul2 li').click(
					function() {
						var knowledgeId = $(this).data("id");
						var sId = $(this).data("s");
						location.href = "knowledge/list?type="+knowledgeId+"&s="+sId;
					});
			
		});
	</script>
</body>
</html>